BY Dhruv Parthasarathy
(Director of AI Programs @ Udacity)

matrices-f40c28c6-14e4-4e99-9470-e317be1dfe74

M a t r i c e s M a t r i c e s MatricesMatricesMatrices


Many of us have probably encountered matrices at some point in math. They're these tables with seemingly byzantine rules for combining them. Take the first element of the first row, first element of the first column, multiply them together, then add, then spin three times fast... And this is to say nothing for the rules of inverting.

How did someone come up with this?

We all probably memorized these rules at some point, but what's really going on underneath it all? How did someone actually come up with these rules and the very idea of matrices? Through this post, we'll aim to answer these questions through deriving matrices ourselves and seeing their underlying intuition.

Representing Functions

Before we jump into matrices, we need to start by understanding functions and how we represent them. Functions can be thought of as rules that take in an input and return an output.
One simple way to represent a function is to have a table that takes every input and displays the function's output. For instance, for a function f f fff we could write:
x x xxx f ( x ) f ( x ) f(x)f(x)f(x)
1 2
2 4
3 6
This is a perfectly fine representation, although very verbose (the table would include every input and output combination). Can we create a simpler representation?
Yes: f ( x ) = 2 x f ( x ) = 2 x f(x)=2xf(x) = 2xf(x)=2x. This representation, a polynomial, is not only concise, but powerful.
How? Let's say I have another function g ( x ) = 10 x g ( x ) = 10 x g(x)=10 xg(x) = 10xg(x)=10x, and someone asks, “what happens if I apply f f fff, followed by g g ggg?".
Before I had this representation, I would have had to make a full table where I write out f(x), and then apply g(x) on it per input like below:
x x xxx f ( x ) f ( x ) f(x)f(x)f(x) g ( f ( x ) ) g ( f ( x ) ) g(f(x))g(f(x))g(f(x))
1 2 20
2 4 40
3 6 60
Yikes. This is tedious.
But now that we have the polynomial representation, we can just do
g ( x ) = 10 x g ( x ) = 10 x g(x)=10 xg(x) = 10xg(x)=10x
g ( f ( x ) ) = 10 f ( x ) g ( f ( x ) ) = 10 f ( x ) g(f(x))=10*f(x)g(f(x)) = 10\cdot f(x)g(f(x))=10f(x)
g ( f ( x ) ) = 20 x g ( f ( x ) ) = 20 x g(f(x))=20 xg(f(x)) = 20xg(f(x))=20x
Using simple steps, we can figure out g ( f ( x ) ) g ( f ( x ) ) g(f(x))g(f(x))g(f(x)) and describe the composition function for any arbitrary input. The same is true of g ( x ) + f ( x ) g ( x ) + f ( x ) g(x)+f(x)g(x) + f(x)g(x)+f(x) etc.
In short, the right representation allows us to quickly understand, combine, and process functions.

Linear Maps

Let's now focus on a specific type of functions that form the foundations of matrices: Linear Maps. Linear Maps are functions that have a few special properties. Here's a simple example of a linear map:
  • f ( x ) = 3 x f ( x ) = 3 x f(x)=3xf(x) = 3xf(x)=3x for real numbers x x xxx.
The special properties of these functions are:
  1. f ( c x ) = c f ( x ) f ( c x ) = c f ( x ) f(c*x)=c*f(x)f(c \cdot x) = c \cdot f(x)f(cx)=cf(x)
    • You can multiply by a scalar before or after applying the function and get the same result.
    • Our example function:
      • f ( 5 x ) = 3 5 x = 15 x = 5 f ( x ) f ( 5 x ) = 3 5 x = 15 x = 5 f ( x ) f(5*x)=3*5x=15 x=5*f(x)f(5\cdot x) = 3 \cdot 5x = 15x = 5 \cdot f(x)f(5x)=35x=15x=5f(x).
  2. f ( x + y ) = f ( x ) + f ( y ) f ( x + y ) = f ( x ) + f ( y ) f(x+y)=f(x)+f(y)f(x+y) = f(x) + f(y)f(x+y)=f(x)+f(y)
    • You can add before or after applying the function and get the same result.
    • Our example function:
      • f ( x + y ) = 3 ( x + y ) = 3 x + 3 y = f ( x ) + f ( y ) f ( x + y ) = 3 ( x + y ) = 3 x + 3 y = f ( x ) + f ( y ) f(x+y)=3*(x+y)=3x+3y=f(x)+f(y)f(x + y) = 3 \cdot (x + y) = 3x + 3y = f(x) + f(y)f(x+y)=3(x+y)=3x+3y=f(x)+f(y).
Early mathematicians realized that such functions can model a lot of the phenomena that happen in the real world from physics, to statistics. In fact, geometrically, all linear maps can be thought of as rotations and scalings:
  • Rotations
    • Functions that rotate shapes around a point.
  • Scalings
    • Functions that takes a 2d image and scale their width and/or height.
    • scaling example

Representing Linear Maps

Now that we've understood linear maps, how can we represent succinctly in a way that makes them easy to combine and use?

1-Dimension

Let's start with linear maps that take in real numbers and return real numbers (all in 1 dimension - the real line).
(Missing.1)
These linear transforms can always be written as f ( x ) = m x + b f ( x ) = m x + b f(x)=mx+bf(x) = mx+bf(x)=mx+b for some m m mmm & b b bbb. Pretty simple!
Notice how points on first number line maps to output number line.

2-Dimensions

But what about in 2 dimensions (i.e. the input is a vector such as [ 1 0 ] 1 0 [[1],[0]]\textcolor{blue}{\begin{bmatrix} 1 \\ 0 \end{bmatrix}}[10] and the output is also a vector in 2D)?
Let's say f ( x ) f ( x ) f(x)f(x)f(x) is a scaling function that stretches its input width by 3x and its height by 5x. You can see it visually below:
Embedded Image
The linear map f f fff scales the purple rectangle into the black rectangle.

Let’s just start by describing what the function does to two very simple vectors [ 1 0 ] 1 0 [[1],[0]]\textcolor{blue}{\begin{bmatrix} 1 \\ 0 \end{bmatrix}}[10] and [ 0 1 ] 0 1 [[0],[1]]\textcolor{#228B22}{\begin{bmatrix} 0 \\ 1 \end{bmatrix}}[01].
We define:
f ( [ 1 0 ] ) = [ 3 0 ] f ( 1 0 ) = 3 0 f([[1],[0]])=[[3],[0]]f(\textcolor{blue}{\begin{bmatrix}1 \\0\end{bmatrix}}) = \begin{bmatrix} 3 \\ 0\end{bmatrix}f([10])=[30]
f ( [ 0 1 ] ) = [ 0 5 ] f ( 0 1 ) = 0 5 f([[0],[1]])=[[0],[5]]f(\textcolor{#228B22}{\begin{bmatrix}0 \\1\end{bmatrix}}) = \begin{bmatrix}0 \\5\end{bmatrix}f([01])=[05]
Based on this, can we figure out f [ 10 9 ] f 10 9 f[[10],[9]]f\begin{bmatrix} \textcolor{blue}{10} \\ \textcolor{#228B22}{9}\end{bmatrix}f[109] is? Amazingly, yes!

The below diagram is going to show our approach visually:
Embedded Image
We will decompose [ 10 9 ] 10 9 [[10],[9]]\begin{bmatrix} \textcolor{blue}{10} \\ \textcolor{#228B22}{9}\end{bmatrix}[109] into a combination of [ 1 0 ] ) 1 0 ) [[1],[0]])\textcolor{blue}{\begin{bmatrix} 1 \\ 0\end{bmatrix}})[10]) and [ 0 1 ] ) 0 1 ) [[0],[1]])\textcolor{#228B22}{\begin{bmatrix} 0 \\1\end{bmatrix})}[01]) (the two vectors which we know the value of f f fff for).

More precisely, here's how we find the final value:
f ( [ 10 9 ] ) = f ( [ 10 0 ] ) + f ( [ 0 9 ] ) f ( 10 9 ) = f ( 10 0 ) + f ( 0 9 ) f([[10],[9]])=f([[10],[0]])+f([[0],[9]])f(\begin{bmatrix} \textcolor{blue}{10} \\ \textcolor{#228B22}{9}\end{bmatrix}) = f(\begin{bmatrix} \textcolor{blue}{10} \\ 0\end{bmatrix}) + f(\begin{bmatrix} 0 \\ \textcolor{#228B22}{9}\end{bmatrix})f([109])=f([100])+f([09])
= 10 f ( [ 1 0 ] ) + 9 f ( [ 0 1 ] ) = 10 f ( 1 0 ) + 9 f ( 0 1 ) =10*f([[1],[0]])+9*f([[0],[1]])= 10 \cdot f( \textcolor{blue}{\begin{bmatrix}1 \\0\end{bmatrix})} + 9 \cdot f(\textcolor{#228B22}{\begin{bmatrix} 0 \\ 1 \end{bmatrix})}=10f([10])+9f([01])
= 10 [ 3 0 ] + 9 [ 0 5 ] = 10 3 0 + 9 0 5 =10*[[3],[0]]+9*[[0],[5]]= 10 \cdot \textcolor{blue}{\begin{bmatrix} 3 \\ 0 \end{bmatrix}} + 9\cdot \textcolor{#228B22}{\begin{bmatrix} 0 \\ 5 \end{bmatrix}}=10[30]+9[05]
= [ 30 0 ] + [ 0 45 ] = 30 0 + 0 45 =[[30],[0]]+[[0],[45]]= \textcolor{blue}{\begin{bmatrix} 30 \\ 0 \end{bmatrix}} + \textcolor{#228B22}{\begin{bmatrix} 0 \\ 45 \end{bmatrix}}=[300]+[045]
= [ 30 45 ] = 30 45 =[[30],[45]]= \begin{bmatrix} 30 \\ 45 \end{bmatrix}=[3045]
So we're able to find f ( [ 10 9 ] ) f ( 10 9 ) f([[10],[9]])f(\begin{bmatrix}\textcolor{blue}{10} \\ \textcolor{#228B22}{9}\end{bmatrix})f([109]) by just knowing f ( [ 1 0 ] ) f ( 1 0 ) f([[1],[0]])f(\textcolor{blue}{\begin{bmatrix} 1 \\ 0\end{bmatrix})}f([10]) and f ( [ 0 1 ] ) f ( 0 1 ) f([[0],[1]])f(\textcolor{#228B22}{\begin{bmatrix} 0 \\ 1\end{bmatrix}})f([01]).
In fact this is true more generally - we can represent the function entirely by what it does to the vectors [ 1 0 ] 1 0 [[1],[0]]\textcolor{blue}{\begin{bmatrix}1 \\0\end{bmatrix}}[10] and [ 0 1 ] 0 1 [[0],[1]]\textcolor{#228B22}{\begin{bmatrix}0 \\1 \end{bmatrix}}[01] and use that to find all potential outputs!

Matrices

So is there a way I can quickly say what a linear map does to [ 1 0 ] 1 0 [[1],[0]]\textcolor{blue}{\begin{bmatrix} 1 \\ 0 \end{bmatrix}}[10] and [ 0 1 ] 0 1 [[0],[1]]\textcolor{#228B22}{\begin{bmatrix} 0 \\ 1\end{bmatrix}}[01]?
Yes! A simple 2x2 matrix!
f ( x ) f ( x ) f(x)f(x)f(x) (as we defined it in the previous section) can be represented by the notation
[ f ( [ 1 0 ] ) f ( [ 0 1 ] ) ] f ( 1 0 ) f ( 0 1 ) [[f([[1],[0]]),f([[0],[1]])]]\begin{bmatrix} f(\textcolor{blue}{\begin{bmatrix} 1 \\ 0 \end{bmatrix}}) & f(\textcolor{#228B22}{\begin{bmatrix} 0 \\ 1 \end{bmatrix}}) \end{bmatrix}[f([10])f([01])]
= [ 3 0 0 5 ] = 3 0 0 5 =[[3,0],[0,5]]= \begin{bmatrix} \textcolor{blue}{3} & \textcolor{#228B22}{0} \\ \textcolor{blue}{0} & \textcolor{#228B22}{5} \end{bmatrix}=[3005]
This is extremely cool - we can describe the entire function and how it operates on an infinite number of points by a little 4 value table.
So just like whenever you see f ( x ) = 3 x f ( x ) = 3 x f(x)=3xf(x) = 3xf(x)=3x, you immediately know you’re dealing with a function, when you see a matrix, know that you are dealing with a linear map.

Example of Creating a Matrix Representation

Let's quickly see an example of how we find the matrix representation for a linear map. Let's imagine we have the linear map g g ggg that rotates vectors 90º counter clockwise. What would the matrix G G GGG for this function g g ggg be?
Let's as earlier start with just understanding g g ggg on our two simple vectors:
[ 1 0 ] 1 0 [[1],[0]]\textcolor{blue}{\begin{bmatrix}1 \\ 0\end{bmatrix}}[10] and [ 0 1 ] 0 1 [[0],[1]]\textcolor{#228B22}{\begin{bmatrix}0 \\ 1 \end{bmatrix}}[01].
  1. [ 1 0 ] 1 0 [[1],[0]]\textcolor{blue}{\begin{bmatrix} 1 \\ 0\end{bmatrix}}[10] turned 90º counterclockwise is [ 0 1 ] 0 1 [[0],[1]]\begin{bmatrix}0 \\ 1\end{bmatrix}[01].
Embedded Image
  1. [ 0 1 ] 0 1 [[0],[1]]\textcolor{#228B22}{\begin{bmatrix} 0 \\ 1\end{bmatrix}}[01] turned 90º counterclockwise is [ 1 0 ] 1 0 [[-1],[0]]\begin{bmatrix}-1 \\ 0\end{bmatrix}[10].
Embedded Image
Putting it altogether, we see that G G GGG, the matrix representation of g g ggg, is G = [ 0 1 1 0 ] G = 0 1 1 0 G=[[0,-1],[1,0]]G = \begin{bmatrix} \textcolor{blue}{0} & \textcolor{#228B22}{-1} \\ \textcolor{blue}{1} & \textcolor{#228B22}{0} \end{bmatrix}G=[0110].

Applying the Function

Ok so we know we can represent a linear map as a matrix - but how do we apply this function on an input?
Specifically, say I have the same function g g ggg. I want to apply this function on the vector [ x y ] x y [[x],[y]]\begin{bmatrix} \textcolor{blue}{x} \\ \textcolor{#228B22}{y} \end{bmatrix}[xy].
How do we do it?

Let’s start with what we know:
  1. The first column of the matrix tells us g ( [ 1 0 ] ) g ( 1 0 ) g([[1],[0]])g(\textcolor{blue}{\begin{bmatrix} 1 \\ 0 \end{bmatrix}})g([10]) .
  2. the second column tells us g ( [ 0 1 ] ) g ( 0 1 ) g([[0],[1]])g(\textcolor{#228B22}{\begin{bmatrix} 0 \\ 1 \end{bmatrix}})g([01]).
To make use of that, let's break [ x y ] x y [[x],[y]]\begin{bmatrix} \textcolor{blue}{x} \\ \textcolor{#228B22}{y} \end{bmatrix}[xy] into a combination of [ 1 0 ] 1 0 [[1],[0]]\textcolor{blue}{\begin{bmatrix} 1 \\ 0 \end{bmatrix}}[10] and [ 0 1 ] 0 1 [[0],[1]]\textcolor{#228B22}{\begin{bmatrix}0 \\ 1 \end{bmatrix}}[01].
[ x y ] = x [ 1 0 ] + y [ 0 1 ] x y = x 1 0 + y 0 1 [[x],[y]]=x*[[1],[0]]+y*[[0],[1]]\begin{bmatrix} \textcolor{blue}{x} \\ \textcolor{#228B22}{y} \end{bmatrix} = x \cdot \textcolor{blue}{\begin{bmatrix} 1 \\ 0 \end{bmatrix}} + y \cdot \textcolor{#228B22}{\begin{bmatrix} 0 \\ 1 \end{bmatrix}}[xy]=x[10]+y[01]
g ( [ x y ] ) = g ( x [ 1 0 ] + y [ 0 1 ] ) g ( x y ) = g ( x 1 0 + y 0 1 ) g([[x],[y]])=g(x*[[1],[0]]+y*[[0],[1]])g(\begin{bmatrix} \textcolor{blue}{x} \\ \textcolor{#228B22}{y} \end{bmatrix}) = g(x \cdot \textcolor{blue}{\begin{bmatrix} 1 \\ 0 \end{bmatrix}} + y \cdot \textcolor{#228B22}{\begin{bmatrix} 0 \\ 1 \end{bmatrix}})g([xy])=g(x[10]+y[01])
Thanks to the amazing properties of linear maps ( g ( a + b ) = g ( a ) + g ( b ) g ( a + b ) = g ( a ) + g ( b ) g(a+b)=g(a)+g(b)g(a+b) = g(a) + g(b)g(a+b)=g(a)+g(b)), we can now simplify this to:
= g ( x [ 1 0 ] ) + g ( y [ 0 1 ] ) = g ( x 1 0 ) + g ( y 0 1 ) =g(x*[[1],[0]])+g(y*[[0],[1]])= g(x \cdot \textcolor{blue}{\begin{bmatrix} 1 \\ 0 \end{bmatrix}}) + g(y \cdot \textcolor{#228B22}{\begin{bmatrix} 0 \\ 1 \end{bmatrix}})=g(x[10])+g(y[01])
And then using another property of linear maps ( g ( c a ) = c g ( a ) g ( c a ) = c g ( a ) g(c*a)=c*g(a)g(c \cdot a) = c\cdot g(a)g(ca)=cg(a)),
= x g ( [ 1 0 ] ) + y g ( [ 0 1 ] ) = x g ( 1 0 ) + y g ( 0 1 ) =x*g([[1],[0]])+y*g([[0],[1]])= x\cdot g(\textcolor{blue}{\begin{bmatrix} 1 \\ 0 \end{bmatrix}}) + y \cdot g(\textcolor{#228B22}{\begin{bmatrix} 0 \\ 1 \end{bmatrix}})=xg([10])+yg([01])
And now we apply the knowledge we have (from the columns of the matrix)!
= x [ 0 1 ] + y [ 1 0 ] = x 0 1 + y 1 0 =x*[[0],[1]]+y*[[-1],[0]]= x \cdot \textcolor{blue}{\begin{bmatrix} 0 \\ 1 \end{bmatrix}} + y\cdot \textcolor{#228B22}{\begin{bmatrix} -1 \\ 0 \end{bmatrix}}=x[01]+y[10]
g ( [ x y ] ) = [ 0 x 1 y x + 0 y ] g ( x y ) = 0 x 1 y x + 0 y g([[x],[y]])=[[0x-1y],[x+0y]]g(\begin{bmatrix} \textcolor{blue}{x} \\ \textcolor{#228B22}{y} \end{bmatrix}) = \begin{bmatrix} 0x - 1y \\ x + 0y \end{bmatrix}g([xy])=[0x1yx+0y]
Does this look familiar? Because it is exactly what you would get by carrying out the matrix multiplication [ 0 1 1 0 ] [ x y ] 0 1 1 0 x y [[0,-1],[1,0]]*[[x],[y]]\begin{bmatrix} \textcolor{blue}{0} & \textcolor{#228B22}{-1} \\ \textcolor{blue}{1} & \textcolor{#228B22}{0} \end{bmatrix} \cdot \begin{bmatrix} \textcolor{blue}{x} \\ \textcolor{#228B22}{y} \end{bmatrix}[0110][xy]!
The matrix multiplication rule is just a shorthand for applying the function on a vector! If we ever want to find the result of rotating some vector v v vvv 90º counterclockwise, we just have to compute G v G v GvGvGv.

Matrix Multiplication as Function Composition

Ok so we’ve seen that multiplying a 2x2 matrix by a vector is just applying the function on the vector. But what does matrix multiplication when we are multiplying two 2x2 matrices?
To answer this, we’re going to take a small detour. We know how to apply a function f f fff on an input vector v v vvv. What if I ask you to find the composition h = g ( f ( v ) ) h = g ( f ( v ) ) h=g(f(v))h = g(f(v))h=g(f(v)) where we know f f fff and g g ggg?

Let’s work through this now:
  1. Let G G GGG be the matrix for the function g g ggg.
  2. Let F F FFF be the matrix for function f f fff.
We want to find the matrix H H HHH that represents the function h = g ( f ( v ) ) h = g ( f ( v ) ) h=g(f(v))h = g(f(v))h=g(f(v)).
This is going to be:
H = [ g ( f ( [ 1 0 ] ) g ( f ( [ 0 1 ] ) ) ] H = g ( f ( 1 0 ) g ( f ( 0 1 ) ) H=[[g(f([[1],[0]]),g(f([[0],[1]]))]]H = \begin{bmatrix} g(f(\textcolor{blue}{\begin{bmatrix} 1 \\ 0 \end{bmatrix}}) & g(f(\textcolor{#228B22}{\begin{bmatrix} 0 \\ 1 \end{bmatrix}})) \end{bmatrix}H=[g(f([10])g(f([01]))]
Let F c o l 1 F c o l 1 F_(col1)\textcolor{blue}{F_{col1}}Fcol1 be the first column of F F FFF and let F c o l 2 F c o l 2 F_(col2)\textcolor{#228B22}{F_{col2}}Fcol2 be the second column.
Then we can simplify to:
H = [ g ( F c o l 1 ) g ( F c o l 2 ) ] H = g ( F c o l 1 ) g ( F c o l 2 ) H=[[g(F_(col1)),g(F_(col2))]]H = \begin{bmatrix} g(\textcolor{blue}{F_{col1}}) & g(\textcolor{#228B22}{F_{col2}}) \end{bmatrix}H=[g(Fcol1)g(Fcol2)]
So what’s g ( F c o l 1 ) g ( F c o l 1 ) g(F_(col1))g(\textcolor{blue}{F_{col1}})g(Fcol1)?
Well we just saw earlier that this is just G F c o l 1 G F c o l 1 G*F_(col1)G \cdot \textcolor{blue}{F_{col1}}GFcol1. So we can now write:
H = [ G F c o l 1 G F c o l 2 ] H = G F c o l 1 G F c o l 2 H=[[G*F_(col1),G*F_(col2)]]H = \begin{bmatrix} G \cdot \textcolor{blue}{F_{col1}} & G \cdot \textcolor{#228B22}{F_{col2}} \end{bmatrix}H=[GFcol1GFcol2]
Seem familiar? Because it’s exactly what the formula for the 2x2 matrix multiplication H = G F H = G F H=G*FH = G\cdot FH=GF!
So H H HHH, the matrix representing g ( f ( x ) ) g ( f ( x ) ) g(f(x))g(f(x))g(f(x)), is just G F G F G*FG\cdot FGF.
Thus, matrix multiplication is just a way to compose linear maps.

An Example of Function Composition

Let's work through a full example to see this linear map composition in action.
  1. Let f f fff be our function as earlier (represented by the matrix F = [ 3 0 0 5 ] F = 3 0 0 5 F=[[3,0],[0,5]]F = \begin{bmatrix}3 & 0 \\ 0 & 5\end{bmatrix}F=[3005]).
  2. Let g g ggg be the function that rotates a vector 90º counter-clockwise as before (represented by G = [ 0 1 1 0 ] G = 0 1 1 0 G=[[0,-1],[1,0]]G = \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}G=[0110]).

Finding g g ggg Composed With f f fff
Let's work through h = g f h = g f h=g@fh = g \circ fh=gf applied on the vector v = [ 2 1 ] v = 2 1 v=[[2],[1]]v = \begin{bmatrix} 2 \\ 1\end{bmatrix}v=[21]. We can use just the properties of f f fff and g g ggg to figure out this result (see diagram below).
Embedded Image
  1. We start with v v vvv.
  2. We know f f fff stretches its input by 3 x 3 x 3x3x3x in the x direction and by 5 x 5 x 5x5x5x in the y direction, leading to f ( v ) = [ 6 5 ] f ( v ) = 6 5 f(v)=[[6],[5]]f(v) = \begin{bmatrix} 6 \\ 5 \end{bmatrix}f(v)=[65].
  3. We then just rotate the resulting vector 90º counter-clockwise to get g ( f ( v ) ) = [ 5 6 ] g ( f ( v ) ) = 5 6 g(f(v))=[[-5],[6]]g(f(v)) = \begin{bmatrix} -5 \\ 6 \end{bmatrix}g(f(v))=[56].

g g ggg Composed With f f fff Using Matrices
Do we get the same result when using function composition through matrices? Let's find out:
  1. The matrix for g f g f g@fg \circ fgf is H = G F H = G F H=G*FH = G \cdot FH=GF.
  2. H = G F = [ 0 1 1 0 ] [ 3 0 0 5 ] = [ 0 5 3 0 ] H = G F = 0 1 1 0 3 0 0 5 = 0 5 3 0 H=G*F=[[0,-1],[1,0]][[3,0],[0,5]]=[[0,-5],[3,0]]H = G \cdot F = \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix} \begin{bmatrix} 3 & 0 \\ 0 & 5 \end{bmatrix} = \begin{bmatrix} 0 & -5 \\ 3 & 0 \end{bmatrix}H=GF=[0110][3005]=[0530]
  3. To apply H H HHH on the vector v v vvv we just do H v H v H*vH \cdot vHv.
  4. H v = [ 0 5 3 0 ] [ 2 1 ] = [ 5 6 ] H v = 0 5 3 0 2 1 = 5 6 H*v=[[0,-5],[3,0]][[2],[1]]=[[-5],[6]]H \cdot v = \begin{bmatrix} 0 & -5 \\ 3 & 0 \end{bmatrix} \begin{bmatrix} 2 \\ 1 \end{bmatrix} = \begin{bmatrix} -5 \\ 6 \end{bmatrix}Hv=[0530][21]=[56].
This is exactly what we got when visually applying g ( f ( v ) ) g ( f ( v ) ) g(f(v))g(f(v))g(f(v)). So we were able to get the same result without having to apply each function one at a time - we were just able to use matrix multiplication to find out the final function and apply it directly. While this already saves us time, imagine how much time this would save if we had to compose 10 or 20 different functions!

Plug in matrices to explore the transformations they create when applied to the unit square.
(missing.2)

Big Picture: Matrices Give Us Power

Remember how much power we gained by being able to represent a function as a polynomial? We were able to combine polynomials, compose them, multiply them - we now have all that same power for linear maps!
We can compose them (matrix multiplication), add them (matrix addition), and invert them (matrix inversion) all by following some simple rules.
A more sophisticated way of saying this is we have an algebra on these functions (just like we have an algebra on integers etc.).
This is what linear algebra broadly means - the study of how we can combine and compose linear maps just as we combine and compose numbers etc.

Looking Forward

So we’ve seen pretty clearly that matrices are just functions and that linear algebra is the study of combining these functions.
Understanding this helps us perceive some of the key ideas of linear algebra in a new way. In the next post eigenvectors, we’re going to focus on eigenvectors and see how they provide valuable insights into these linear maps.